package com.abvnet.project.water.api.web;

import com.abvnet.framework.web.controller.BaseController;
import com.abvnet.framework.web.domain.AjaxResult;
import com.abvnet.project.water.project.domain.ProjectLog;
import com.abvnet.project.water.project.service.IProjectLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/project/log")
public class ApiProjectLogController extends BaseController {

    @Autowired
    private IProjectLogService projectLogService;

    @GetMapping("/list")
    public AjaxResult list(ProjectLog projectLog) {
        return AjaxResult.success(projectLogService.selectProjectLogListForApi(projectLog));
    }

    @GetMapping("/get")
    public AjaxResult get(@RequestParam("logId") Long logId) {
        return AjaxResult.success(projectLogService.selectProjectLogForApi(logId));
    }

    @PostMapping("/add")
    public AjaxResult addSave(ProjectLog projectLog) {
        return toAjax(projectLogService.insertProjectLog(projectLog));
    }

    @PostMapping("/edit")
    public AjaxResult editSave(ProjectLog projectLog) {
        return toAjax(projectLogService.updateProjectLog(projectLog));
    }
}
